﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ImageCompare.Core
{
    public class ShowMsg
    {        
        delegate void ShowMsgCallBack(ListBox listbox, string text);
        public static void showMsg(ListBox listbox, string text)
        {
            if (listbox.InvokeRequired)
            {
                ShowMsgCallBack showMsgCallBack = showMsg;
                listbox.Invoke(showMsgCallBack, new object[] { listbox, text });
                if (listbox.Items.Count > 1000)
                    listbox.Items.Clear();
            }
            else
            {
                listbox.Items.Add(text);
                listbox.SelectedIndex = listbox.Items.Count - 1;
                listbox.ClearSelected();
            }
        }
    }
}
